/*$(document).ready(function () {*/
$(function () {
    $("html,body").animate({scrollTop:0},"fast");//默认停在顶端

    var bt = $('#toolBackTop');
    bt.hide();
    var sw = $(document.body)[0].clientWidth;

    var limitsw = (sw - 840) / 2 - 80;  //距离右侧距离
    if (limitsw > 0) {
        limitsw = parseInt(limitsw);
        bt.css("right", limitsw / 8);
    }

    $(window).scroll(function () {
        var st = $(window).scrollTop();
        if (st > 30) {
            bt.show();
        } else {
            bt.hide();
        }
    });


    //查看微信
    $("[data-toggle='weixinpopvoer']").popover({
        trigger: 'manual',
        placement: 'right', //placement of the popover. also can use top, bottom, left or right
        html: 'true', //needed to show html of course
        content: content2(), //this is the content of the html box. add the image here or anything you want really.
        animation: false
    }).on("mouseenter", function () {
        var _this = this;
        $(this).popover("show");LinkController;
        $(this).siblings(".popover").on("mouseleave", function () {
            $(_this).popover('hide');
        });
    }).on("mouseleave", function () {
        var _this = this;
        setTimeout(function () {
            if (!$(".popover:hover").length) {
                $(_this).popover("hide")
            }
        }, 100);
    });


    //登录
    $("#login-btn").click(function () {
        window.location.href = "/user/login"
    });
    //退出
    $("#logout-btn").click(function () {
        $.ajax({
            //请求方式
            type: "POST",
            //请求地址
            url: "/user/logout",
            //数据，json字符串
            data: '',
            //请求成功
            success: function (result) {
                window.location.href = "/index";
            },
            //请求失败，包含具体的错误信息
            error: function (e) {
                window.location.href = "/index";
            }
        });
    });
    $("#manage-btn").click(function () {
        window.location.href = "/manage"
    });
});
function guolv(a) {
    if (a < 10)
        return '0' + a;
    return a;
}
function gotop() {
    $('html,body').animate({scrollTop: '0px'}, 'fast');
}
function content2() {
    var data = $("<div>" +
        "<div>" +
        "<img src='/style/images/system/wx.jpg' style='width: 115px; height: 115px;margin: -5px;'>" +
        "</div>");
    return data;
}